
package org.itboys.mobile.service.mongo.web;

import org.itboys.commons.utils.tools.ListUtil;
import org.itboys.commons.utils.tools.LongUtil;
import org.itboys.mobile.common.SundayCommonConstants;
import org.itboys.mobile.dao.product.SundayProductCategoryMapper;
import org.itboys.mobile.dao.product.SundayProductMapper;

import org.itboys.mobile.dto.SundayPermissionDto;
import org.itboys.mobile.entity.mongo.SundayPermission;
import org.itboys.mobile.entity.mysql.product.SundayProduct;
import org.itboys.mobile.entity.mysql.product.SundayProductCategory;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseMongoService;
import org.itboys.mongodb.utils.page.Page;
import org.itboys.param.PageResult;
import org.itboys.param.ParamUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 作者：jiangxiong
 * 日期：2017年5月8日
 * 联系方式 ：empty90911@126.com
 * 描述：圣代_关联_权限。
 *
 */

@Service
public class SundayPermissionService extends BaseMongoService<SundayPermission> {
	@Autowired
	private SundayProductCategoryMapper categoryMapper;
	@Autowired
	private SundayProductMapper productMapper;


	private static final long serialVersionUID = -5806434055381127192L;

	@Resource(name = "mobileDs")
	private MongoDataSource sundayDataSource;

	@Override
	protected MongoDataSource getMongoDataSource() {
		return sundayDataSource;
	}

	@Override
	protected Class<SundayPermission> getEntityClass() {
		return SundayPermission.class;
	}


	/**
	 *
	 *获取门店同步到的商品库存信息。系统也会自动同步
	 * @param memberId
	 * @return
	 */
	public PageResult<SundayPermission> selectPermission(HttpServletRequest request, Long memberId) {
		Map<String, Object> param = ParamUtil.packageMongoExactParam(request, "");
		param.put("isDeleted", 0);
		param.put("memberId", memberId);
		Map<String, String> containsparam = ParamUtil.packageMongoVagueParam(request, "productNo","name");
		return super.containpageQuery(request, containsparam, param);
	}



}